import { createContext, useContext } from 'react'
import type { Graph } from '@antv/x6'
import type { RefObject } from 'react'

export interface ProcessMiningEngineContextValue {
  graph: Graph | null
  containerRef: RefObject<HTMLDivElement | null>
}

export const ProcessMiningEngineContext = createContext<ProcessMiningEngineContextValue | null>(null)

export const useProcessMiningEngine = () => {
  const context = useContext(ProcessMiningEngineContext)
  if (!context) {
    throw new Error('useProcessMiningEngine must be used within ProcessMiningEngineProvider')
  }
  return context
}

